package com.mycity.bean;

import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Email;



public class User {

	@NotNull(message="Email Address is compulsory")  
    @NotBlank(message="Email Address is compulsory") 
    @Email(message = "Email Address is not a valid format") 
    private String email;

	@NotNull(message = "First name is compulsory") 
	@NotBlank(message = "First name is compulsory")  
	@Pattern(regexp = "[a-z-A-Z]*", message = "First name has invalid characters") 
	private String firstName;
    
	@NotNull(message = "Last name is compulsory") 
    @NotBlank(message = "Last name is compulsory")  
    @Pattern(regexp = "[a-z-A-Z]*", message = "Last name has invalid characters") 
	private String lastName;

    private int level;
    
    private String[] achievements;
    
    private String bio;
    
    private String profilePic;
    
    public String getBio() {
		return bio;
	}

	public void setBio(String bio) {
		this.bio = bio;
	}

	public String getProfilePic() {
		return profilePic;
	}

	public void setProfilePic(String profilePic) {
		this.profilePic = profilePic;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String[] getAchievements() {
		return achievements;
	}

	public void setAchievements(String[] achievements) {
		this.achievements = achievements;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}
	@NotNull(message = "Password is compulsory") 
    @NotBlank(message = "Password is compulsory")  
	private String password;

//    @Past(message = "Date of Birth must be in the past") 
//	private Date birthday;
        
    private String username;
    
    private int userId;


	/**
     * Empty Constructor. Needed for JAXB.
     */
	public User(){
		
	}
	
    @JsonCreator
	public User(@JsonProperty("email") String email, @JsonProperty("firstName")  String firstName, @JsonProperty("lastName") String lastName, @JsonProperty("password") String password,
			@JsonProperty("username") String username, @JsonProperty("userId") int userId, @JsonProperty("level") int level, @JsonProperty("achievements") String[] achievements,
			@JsonProperty("bio") String bio, @JsonProperty String profilePic){
		this.email = email;
		this.firstName = firstName;
		this.lastName = lastName;
		this.password = password;
		this.userId = userId;
		this.username = username;
		this.level = level;
		this.achievements = achievements;
		this.bio = bio;
		this.profilePic = profilePic;
	}
	    
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}


	
}
